<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>地图设置</title>
<link href="./css/style.css" rel="stylesheet" type="text/css" />
<{insert_scripts files="./js/jquery.min.js"}>
<style type="text/css">
#container div{ border:0px;};
</style>
<script charset="utf-8" src="http://api.map.soso.com/v1.0/main.js"></script>
<script>
var init = function() {
var map,markersArray = [];
<{if $res.0.value&&$res.1.value}>
    var center = new soso.maps.LatLng(<{$res.0.value}>,<{$res.1.value}>);
<{else}>	
    var center = new soso.maps.LatLng(39.916527,116.397128);
<{/if}>	
    var map = new soso.maps.Map(document.getElementById('container'),{
        center: center,
        minZoom:6,
        maxZoom:16,
        zoomLevel:14
    });
    var marker = new soso.maps.Marker({
        position: center,
        map: map
    });
	markersArray.push(marker);
    var info = new soso.maps.InfoWindow({
        map: map
    });
//    soso.maps.Event.addListener(marker, 'click', function() {
//        info.setAnimation(soso.maps.Animation.POP);
//        info.open('<div style="width:200px;height:30px;">'
//            + '此处是公司的地址！</div>',
//            marker
//        );
//    });
	soso.maps.Event.addListener(map, 'click', function(event) {

		//
        // alert('您点击的位置为: [' + event.latLng.getLat() + ', ' +
        //event.latLng.getLng() + ']');
		$("input[name='Matt'] ").val(event.latLng.getLat());
		$("input[name='Mlat'] ").val(event.latLng.getLng());
		 map.moveTo(new soso.maps.LatLng(event.latLng.getLat(), event.latLng.getLng()));
		 deleteOverlays();
		 addMarker(event.latLng);	
    });
function addMarker(location) {
    var marker = new soso.maps.Marker({
        position: location,
        map: map
    });
    markersArray.push(marker);
}	
function deleteOverlays() {
    if (markersArray) {
        for (i in markersArray) {
            markersArray[i].setMap(null);
        }
        markersArray.length = 0;
    }
}	
}
 $(window).load(function() {
     init();
 });
</script>
 
</head>
<body>
    <form name="form1" method="post" action="./index.php?c=admin&a=sysconfig&mod=mapinfo&act=save" id="form1"> 
        <div class="box">
            <div class="box2">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <th>
                            地址：</th>
                        <td>
                            <input name="Addr" type="text" value="<{$res.3.value}>" id="txtAddress" class="txtbox_P" style="width:500px;" />
                        </td>
                    </tr>
                    <tr>
                        <th>
                            电话：</th>
                        <td>
                            <input name="Tel" type="text" value="<{$res.4.value}>" id="txtTel" class="txtbox_P" style="width:500px;" />
                        </td>
                    </tr>
                    <tr>
                        <th>
                            传真：</th>
                        <td>
                            <input name="Fax" type="text" value="<{$res.5.value}>" id="txtFax" class="txtbox_P" style="width:500px;" />
                        </td>
                    </tr>
                    <tr>
                        <!--<th>
                            其他：</th>
                        <td>
                            <textarea name="txtOther" rows="2" cols="20" id="txtOther" class="txtbox_P" style="height:50px;width:500px;">邮编：200061&lt;br/&gt;&lt;br/&gt;网址：http://www.arcaneltd.com/</textarea>
                        </td>-->
                    </tr>
                    <{*------------------------
                    <tr>
                        <th style="border-bottom: #cccccc 1px solid;">
                            地区地图设定：</th>
                        <td>
                            经度：<input name="Matt" type="text" value="<{$res.0.value}>" id="txtjingdu" class="txtbox_P" style="width:140px;" />
                            纬度：<input name="Mlat" type="text" value="<{$res.1.value}>" id="txtweidu" class="txtbox_P" style="width:140px;" /><span
                                style="color: #cc3366"> 提示：在地图上单击可自动设定所单击处的经纬度，设置后请保存</span>
                        </td>
                    </tr>
                    ---------*}>
                    <tr>
                    <th></th>
                        <td colspan="2" >
                            <input type="submit" name="Button1" value="保存" id="Button1" class="add" style="font-weight:bold;width:70px;" /></td>
                    </tr>
                    <tr>
                        <td colspan="2">
						<div style="width:100%;height:300px; display:none" id="container"></div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
</body> 
</html>

